/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.maze.behaviours;

import java.util.Random;
import org.maze.individual.Individual;

/**
 *
 * @author Thomas
 */
public class DeletionMutateBehaviour implements IMutateBehaviour{
    private static final Random rand = new Random();
    public byte[] mutate(byte[] genome) throws Exception{
        if(rand.nextInt(1000)==4){
            int pos = rand.nextInt(genome.length-10);
            int size = rand.nextInt(genome.length-pos-4)+1;
            int pos2 = pos+size;
            for(int i=0; i< genome.length-pos2 ; i++){
                genome[i+pos]=genome[i+pos2];
            }
            Individual.fillBlank(genome, genome.length-size);
        }
        return genome;
    }

}
